package reflect;

import java.lang.reflect.Method;
import java.util.Scanner;

public class ReflectDemo1 {
    public static void main(String[] args) throws ClassNotFoundException {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入类名:");
        String className = sc.next();
        Class cls = Class.forName(className);

        String name = cls.getName();
        System.out.println(name);

        System.out.println(cls.getSimpleName());

        Package pkg = cls.getPackage();
        System.out.println(pkg.getName());

        Method[] methods = cls.getMethods();
        for (Method method : methods) {
            System.out.println(method.getName());
        }
    }
}
